using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

/**
*@file       DBRole_CreateSender.cs
*@brief      send message DBRole_Create
*
*@author     graywind
*@version    1.0.0.1
*@data       2012/4/14
*/

//send message DBRole_Create
public class msgDBRole_Create
{
    public const int MessageId = (int)DBServerTypes.MessageType.DBRole_Create;
    //TODO
	public int SessionId = NetLib.INVALID_SESSION;
	public dbserver.CreateRole MsgContent = new dbserver.CreateRole();
	/// <summary>
	/// Initializes a new instance of the <see cref="msgDBRole_Create"/> class.
	/// </summary>
	/// <param name='session_id'>
	/// Session_id.
	/// </param>
	/// <param name='usr_id'>
	/// Usr_id.
	/// </param>
	/// <param name='role_name'>
	/// Role_name.
	/// </param>
	/// <param name='gender'>
	/// Gender.
	/// </param>
	/// <param name='job'>
	/// Job.
	/// </param>
	/// <param name='login_code'>
	/// Login_code.
	/// </param>
	public msgDBRole_Create(int session_id, int usr_id, string role_name, int gender, int job, int login_code)
	{
		MsgContent.UsrId = usr_id;
		MsgContent.RoleName = role_name;
		MsgContent.Gender = gender;
		MsgContent.JobType = job;
		MsgContent.LoginCode = login_code;
		MsgContent.Level = 1;
		MsgContent.World = 0;
		
		MsgContent.Detail.GraphicsId = 0;
	}
}

//handle message
public partial class gwMessagePort
{
    /// <summary>
    /// handle message
    /// </summary>
    /// <param name="msg">message wrapper of DBRole_Create</param>
    public static void ProcessMessage(msgDBRole_Create msg)
    {
        //TODO
        //Main Message:  msgDBServer
		msgDBServer mainMsg = new msgDBServer(msg.SessionId, msgDBRole_Create.MessageId, ProtoNet<dbserver.CreateRole>.IntoBytes(msg.MsgContent));
		gwMessagePort.ProcessMessage(mainMsg);
    }
}
